package file;

import java.io.*;

public class Demo12 {
    public static void main(String[] args) {
        try (OutputStream outputStream = new FileOutputStream("test2.txt")){
            // 此处 PrintWriter 和 System.out 的用法相似
            PrintWriter printWriter = new PrintWriter(outputStream);
            printWriter.println("hello");
            printWriter.flush();
        }catch (IOException e) {
            e.printStackTrace();
        }
    }
}
